﻿model Model1
  Modelica.Electrical.Analog.Basic.Resistor resistor(R=5000) 
    annotation (Placement(transformation(origin={-66,-36}, 
extent={{-10,-10},{10,10}})));
  Modelica.Electrical.Analog.Basic.Ground ground 
    annotation (Placement(transformation(origin={-84,-96}, 
extent={{-10,-10},{10,10}})));
  Modelica.Electrical.Analog.Basic.OpAmpDetailed opAmp(Rdm=2.0e8,Rout=50,sr_p=0.5e8,sr_m=0.5e8) 
    annotation (Placement(transformation(origin={-2,-42}, 
extent={{-10,10},{10,-10}})));
  Modelica.Electrical.Analog.Basic.Capacitor capacitor(C=1e-8) 
    annotation (Placement(transformation(origin={-66,-58}, 
extent={{-10,-10},{10,10}})));
  Modelica.Electrical.Analog.Basic.Resistor resistor1(R=5000) 
    annotation (Placement(transformation(origin={-50,24}, 
extent={{-10,-10},{10,10}}, 
rotation=90)));
  Modelica.Electrical.Analog.Basic.Capacitor capacitor1(C=1e-8) 
    annotation (Placement(transformation(origin={-50,-6}, 
extent={{-10,-10},{10,10}}, 
rotation=90)));
  Modelica.Electrical.Analog.Basic.Resistor resistor2(R=20000) 
    annotation (Placement(transformation(origin={-28,-14}, 
extent={{-10,-10},{10,10}}, 
rotation=90)));
  Modelica.Electrical.Analog.Basic.Resistor resistor3(R=10000) 
    annotation (Placement(transformation(origin={-28,-68}, 
extent={{-10,-10},{10,10}}, 
rotation=90)));
  Modelica.Electrical.Analog.Sources.SupplyVoltage supplyVoltage 
    annotation (Placement(transformation(origin={32,-68}, 
extent={{-10,-10},{10,10}})));
  Modelica.Electrical.Analog.Sensors.VoltageSensor V 
    annotation (Placement(transformation(origin={66,-62}, 
extent={{-10,10},{10,-10}}, 
rotation=-90)));
  Modelica.Electrical.Analog.Ideal.IdealDiode diode(Vknee=0) 
    annotation (Placement(transformation(origin={-28,14}, 
extent={{-10,-10},{10,10}}, 
rotation=-90)));
  Modelica.Electrical.Analog.Ideal.IdealDiode diode1(Vknee=0) 
    annotation (Placement(transformation(origin={-8,14}, 
extent={{-10,-10},{10,10}}, 
rotation=90)));
  Modelica.Electrical.Analog.Basic.OpAmpDetailed opAmp1(Rdm=2.0e8,Rout=20,sr_p=0.5e8,sr_m=0.5e8) 
    annotation (Placement(transformation(origin={214,-42}, 
extent={{-10,10},{10,-10}})));
  Modelica.Electrical.Analog.Basic.Resistor resistor5(R=1000) 
    annotation (Placement(transformation(origin={168,-36}, 
extent={{-10,-10},{10,10}})));
  Modelica.Electrical.Analog.Basic.Resistor resistor6(R=1000) 
    annotation (Placement(transformation(origin={188,-70}, 
extent={{-10,10},{10,-10}}, 
rotation=-90)));
  Modelica.Electrical.Analog.Basic.Resistor resistor7(R=8800) 
    annotation (Placement(transformation(origin={214,-8}, 
extent={{-10,-10},{10,10}})));
  Modelica.Electrical.Analog.Sources.SupplyVoltage supplyVoltage1 
    annotation (Placement(transformation(origin={244,-70}, 
extent={{10,-10},{-10,10}}, 
rotation=-180)));
  Modelica.Electrical.Analog.Sensors.VoltageSensor Vout 
    annotation (Placement(transformation(origin={304,-42}, 
extent={{-10,-10},{10,10}})));
  Modelica.Electrical.Analog.Basic.Capacitor capacitor3(C=1e-8) 
    annotation (Placement(transformation(origin={266,-42}, 
extent={{-10,-10},{10,10}})));
  Modelica.Electrical.Analog.Basic.Resistor resistor8(R=100000) 
    annotation (Placement(transformation(origin={286,-64}, 
extent={{-10,10},{10,-10}}, 
rotation=-90)));
  Modelica.Electrical.Analog.Basic.OpAmp opAmp2 
    annotation (Placement(transformation(origin={108,-36}, 
extent={{-10,-10},{10,10}})));
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltageSensor2 if false 
    annotation (Placement(transformation(origin={148,-62}, 
extent={{-10,-10},{10,10}})));
  Modelica.Electrical.Analog.Sources.SupplyVoltage supplyVoltage2 
    annotation (Placement(transformation(origin={98,-68}, 
extent={{-10,-10},{10,10}})));
  annotation(Diagram(coordinateSystem(extent={{-100,-100},{100,100}}, 
grid={2,2})));
equation
  connect(resistor.p, capacitor.p) 
  annotation(Line(origin={-70,-45}, 
points={{-6,9},{-14,9},{-14,-13},{-6,-13}}, 
color={0,0,255}));
  connect(resistor.n, capacitor.n) 
  annotation(Line(origin={-50,-45}, 
points={{-6,9},{0,9},{0,-13},{-6,-13}}, 
color={0,0,255}));
  connect(capacitor.p, ground.p) 
  annotation(Line(origin={-70,-63}, 
points={{-6,5},{-14,5},{-14,-23}}, 
color={0,0,255}));
  connect(capacitor1.p, resistor.n) 
  annotation(Line(origin={-50,-30}, 
points={{0,14},{0,-6},{-6,-6}}, 
color={0,0,255}));
  connect(capacitor1.n, resistor1.p) 
  annotation(Line(origin={-50,5}, 
points={{0,-1},{0,9}}, 
color={0,0,255}));
  connect(resistor.n, opAmp.p) 
  annotation(Line(origin={-31,-36}, 
points={{-25,0},{19,0}}, 
color={0,0,255}));
  connect(resistor3.n, resistor2.p) 
  annotation(Line(origin={-28,-41}, 
  points={{0,-17},{0,17}}, 
  color={0,0,255}));
  connect(resistor3.p, ground.p) 
  annotation(Line(origin={-49,-82}, 
points={{21,4},{21,-4},{-35,-4}}, 
color={0,0,255}));
  connect(opAmp.outp, resistor1.n) 
  annotation(Line(origin={-18,-4}, 
points={{26,-38},{44,-38},{44,44},{-32,44},{-32,38}}, 
color={0,0,255}));
  connect(opAmp.m, resistor2.p) 
  annotation(Line(origin={-20,-36}, 
  points={{8,-12},{-8,-12},{-8,12}}, 
  color={0,0,255}));
  connect(supplyVoltage.ground, resistor3.p) 
  annotation(Line(origin={2,-78}, 
points={{30,10},{30,-8},{-30,-8},{-30,0}}, 
color={0,0,255}));
  connect(opAmp.p_supply, supplyVoltage.pin_p) 
  annotation(Line(origin={10,-60}, 
  points={{-12,8},{-12,-8},{12,-8}}, 
  color={0,0,255}));
  connect(supplyVoltage.pin_n, opAmp.m_supply) 
  annotation(Line(origin={22,-50}, 
points={{20,-18},{23,-18},{23,26},{-24,26},{-24,18}}, 
color={0,0,255}));
  connect(diode.p, diode1.n) 
  annotation(Line(origin={-18,24}, 
  points={{-10,0},{10,0}}, 
  color={0,0,255}));
  connect(diode1.n, resistor1.n) 
  annotation(Line(origin={-29,29}, 
points={{21,-5},{21,11},{-21,11},{-21,5}}, 
color={0,0,255}));
  connect(diode1.p, diode.n) 
  annotation(Line(origin={-18,4}, 
  points={{10,-1.77636e-15},{-10,-1.77636e-15},{-10,0}}, 
  color={0,0,255}));
  connect(resistor2.n, diode.n) 
  annotation(Line(origin={-28,0}, 
  points={{0,-4},{0,4}}, 
  color={0,0,255}));
  connect(resistor5.n, opAmp1.p) 
  annotation(Line(origin={324,-42}, 
points={{-146,6},{-120,6}}, 
color={0,0,255}));
  connect(resistor6.p, opAmp1.m) 
  annotation(Line(origin={196,-57}, 
points={{-8,-3},{-8,9},{8,9}}, 
color={0,0,255}));
  connect(resistor7.n, opAmp1.outp) 
  annotation(Line(origin={224,-28}, 
points={{0,20},{10,20},{10,-14},{0,-14}}, 
color={0,0,255}));
  connect(supplyVoltage1.pin_p, opAmp1.p_supply) 
  annotation(Line(origin={224,-64}, 
points={{10,-6},{-10,-6},{-10,12}}, 
color={0,0,255}));
  connect(opAmp1.m_supply, supplyVoltage1.pin_n) 
  annotation(Line(origin={234,-54}, 
points={{-20,22},{-20,26},{32,26},{32,-16},{20,-16}}, 
color={0,0,255}));
  connect(supplyVoltage1.ground, resistor6.n) 
  annotation(Line(origin={216,-75}, 
points={{28,5},{28,-11},{-28,-11},{-28,-5}}, 
color={0,0,255}));
  connect(Vout.n, resistor6.n) 
  annotation(Line(origin={270,-64}, 
points={{44,22},{48,22},{48,-22},{-82,-22},{-82,-16}}, 
color={0,0,255}));
  connect(resistor6.n, resistor3.p) 
  annotation(Line(origin={86,-82}, 
points={{102,2},{102,-4},{-114,-4},{-114,4}}, 
color={0,0,255}));
  connect(V.n, resistor3.p) 
  annotation(Line(origin={42,-79}, 
points={{24,7},{24,-7},{-70,-7},{-70,1}}, 
color={0,0,255}));
  connect(resistor7.p, resistor6.p) 
  annotation(Line(origin={196,-34}, 
points={{8,26},{-8,26},{-8,-26}}, 
color={0,0,255}));
  connect(Vout.p, capacitor3.n) 
  annotation(Line(origin={284,-48}, 
points={{10,6},{-8,6}}, 
color={0,0,255}));
  connect(opAmp1.outp, capacitor3.p) 
  annotation(Line(origin={237,-48}, 
points={{-13,6},{19,6}}, 
color={0,0,255}));
  connect(resistor8.n, resistor6.n) 
  annotation(Line(origin={90,-79}, 
points={{196,5},{196,-7},{98,-7},{98,-1}}, 
color={0,0,255}));
  connect(resistor8.p, capacitor3.n) 
  annotation(Line(origin={277,-50}, 
points={{9,-4},{9,8},{-1,8}}, 
color={0,0,255}));
  connect(V.p, opAmp.outp) 
  annotation(Line(origin={65,-47}, 
points={{1,-5},{1,5},{-57,5}}, 
color={0,0,255}));
  connect(opAmp.outp, opAmp2.in_p) 
  annotation(Line(origin={68,-42}, 
points={{-60,0},{30,0}}, 
color={0,0,255}));
  connect(opAmp2.out, opAmp2.in_n) 
  annotation(Line(origin={108,-33}, 
points={{10,-3},{30,-3},{30,33},{-30,33},{-30,3},{-10,3}}, 
color={0,0,255}));
  connect(opAmp2.out, voltageSensor2.p) 
  annotation(Line(origin={137,-36}, 
points={{-19,0},{1,0},{1,-26}}, 
color={0,0,255}));
  connect(voltageSensor2.n, resistor3.p) 
  annotation(Line(origin={89,-61}, 
points={{69,-1},{69,-25},{-117,-25},{-117,-17}}, 
color={0,0,255}));
  connect(supplyVoltage2.pin_n, opAmp2.VMin) 
  annotation(Line(origin={108,-57}, 
points={{0,-11},{0,11}}, 
color={0,0,255}));
  connect(supplyVoltage2.pin_p, opAmp2.VMax) 
  annotation(Line(origin={98,-47}, 
points={{-10,-21},{-10,21},{10,21}}, 
color={0,0,255}));
  connect(supplyVoltage2.ground, resistor3.p) 
  annotation(Line(origin={50,-77}, 
points={{48,9},{48,-9},{-78,-9},{-78,-1}}, 
color={0,0,255}));
  connect(resistor5.p, opAmp2.out) 
  annotation(Line(origin={192,-39}, 
points={{-34,3},{-74,3}}, 
color={0,0,255}));
  end Model1;